import request from "@/utils/request.js"

export default{

  findById(id){
    return request({
      url:`/product/${id}`,
      method:'get'
    });
  },
  findProduct(){
 return request({
      url:`/product/`,
      method:'get'
    });
  },
  findAll(page,size){
    return request({
      url:`/product/${page}/${size}`,
      method:'get'
    });
  },
  deleteById(id){
    return request({
      url:`/product/${id}`,
      method:'delete'
    });
  },
  save(product){
    return request({
      url:`/product`,
      method:'post',
      data:product
    });
  },
  update(id,product){
    if(id==''){
      return this.save(product)
    }
    return request({
      url:`/product/${id}`,
      method:'put',
      data:product
    });
  },
  search(searchMap,page,size){
    return request({
      url:`/product/search/${page}/${size}`,
      method:'post',
      data:searchMap
    });
  },


}
